<template>
	<div class="container">
		<el-breadcrumb separator-class="el-icon-arrow-right">
			<el-breadcrumb-item :to="{ path: '/Main' }"><b>首页</b></el-breadcrumb-item>
			<el-breadcrumb-item :to="{ path: '/Main/ThotelTopic' }"></el-breadcrumb-item>
			<el-breadcrumb-item><b>修改</b></el-breadcrumb-item>
		</el-breadcrumb>

		<el-form :model="ff" :rules="rules" ref="ff" label-width="100px" class="demo-ruleForm" style="margin-top: 15px;"
		 :inline=true>
			<el-form-item label="编号" prop="id" style="width: 500px;">
				<el-input v-model="ff.id" style="width: 300px;" readonly="readonly"></el-input>
			</el-form-item>

			<el-form-item label="商家回复" prop="reply" style="width: 500px;">
				<el-input v-model="ff.reply" style="width: 300px;"></el-input>
			</el-form-item>




			<el-form-item style="width: 700px;margin-left: 300px;">
				<el-button type="primary" @click="save()">确认</el-button>
				<el-button @click="resetForm('ff')" style="margin-left: 100px;margin-top: 20px;">重置</el-button>
			</el-form-item>
		</el-form>


	</div>
</template>

<script>
	export default {
		data() {

			return {




				ff: {
					id: '',

					reply: '',


				},

				rules: {
					reply: [{
						required: true,
						message: '商家请回复',
						trigger: 'blur'
					}, ],
				}
			};
		},
		methods: {

			
			save: function() {
				console.log("到这里面来了");
				this.$refs['ff'].validate((valid) => {
					if (valid) {
						//获取请求URL
						let url = this.axios.urls.SYS_SD_EDIT;
						// console.log(this.ff);
						//发送ajax请求
						console.log("到这里面来了2222",this.ff);  
						
						this.axios.post(url, this.ff).then((response) => {
							console.log("111",response.data);
							let data = response.data;
							console.log("222",data);
							if (data.success) {
								this.$confirm('新增成功！是否继续添加?', '提示', {
									confirmButtonText: '确定',
									cancelButtonText: '取消',
									type: 'warning',
									center: true
								}).then(() => {
									this.ff.reply = '';
									// this.ff.type = '';
									// this.ff.icon = '';
									
				
								}).catch(() => {})
								// this.$router.replace('/SalChanceList');
							} else {
								this.$message({
									message: "添加成功",
									type: 'success'
								});
							}
							this.$router.replace('/Main/ThotelAssess');
						}).catch(err => {
							console.log(err);
						})
					} else {
						console.log('error submit!!');
						return false;
					}
				});
	}
	},


		created: function() {
			const data = this.$store.getters.getid;

			this.ff.id = data.id;
			if (data.status == '1') {
				data.status = '2';
			}
			this.ff.reply = data.reply;


		}
	}
</script>

<style>
	.container {
		margin: 15px;
	}
</style>
